package com.example.shop_car_2208.net


import com.example.shop_car_2208.entity.*
import io.reactivex.Observable
import okhttp3.MultipartBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Query

/**
 * 接口  网络请求的所以接口
 */
interface ApiService {
    @POST(Const.LOGIN_URL)
    fun login1(@Body param: ParamLogin): Observable<UserEntityResult>

    //协程方式调用
    @POST(Const.LOGIN_URL)
    suspend fun getLogin(@Body param: ParamLogin): UserEntityResult

    @POST(Const.REGISTER_URL)
    suspend fun getRegister(@Body param: RegisterParam): UserEntityResult

    //轮播图
    @GET(Const.BANNER_URL)
    suspend fun getBanner(): BannerResult

    //商品
    @GET(Const.CATE_URL)
    suspend fun getCate(): CateResult

    @GET(Const.GOOD_URL)
    suspend fun getGoods(
        @Query("category_id") category_id: Int,
        @Query("currentPage") currentPage: Int,
        @Query("pageSize") pageSize: Int
    ): GoodsResult
    @GET(Const.DETAIL_URL)
    suspend fun getDetail(@Query("goods_id")goods_id: Int):DetailResult
    @POST(Const.ADDCAR_URL)
    suspend fun getAddCar(@Body param:AddCarParam):AddCarResult
    @GET(Const.SELECT_URL)
    suspend fun getCar():SelectResult
    @POST(Const.DELETECAR_URL)
    suspend fun getDeleteCar(@Body param: DeleteCarParam):AddCarResult
    @Multipart
    @POST(Const.UPDATEICON_URL)
    suspend fun updateIcon(@Part part:MultipartBody.Part):UpDateIconResult
    @GET(Const.COMMENT_URL_ONE)
    suspend fun getComment():CommentEntityResult
    @GET(Const.GETCHILDCOMMENT_URL)
    suspend fun getChildComment(@Query("rootId")rootId:Int):CommentEntityResult
    @POST(Const.COMMENT_URL)
    suspend fun Comment(@Body param:ParamComment):CommentEntityResult
    @POST("/comment/childComment")
    suspend fun HFComment(@Body param:HUIFUCommentParam):CommentEntityResult
}